<?php
/**
 * Created by PhpStorm.
 * User: 94004
 * Date: 2017/12/29
 * Time: 11:30
 */
header("Content-Type:text/html;charset=utf-8;");
$arrFileExt = explode(".", $_FILES["file"]["name"]);
$ext = end($arrFileExt);
$fileName = time() . rand(10000, 99999) . "." . $ext;
$path = "../../uploads/";
$res = move_uploaded_file($_FILES["file"]["tmp_name"], $path . $fileName);
$arr = array("code" => 101, "msg" => "操作失败");
if ($res) {
    $arr["code"] = 100;
    $arr["msg"] = "操作成功";
    $arr["path"] = $path . $fileName;
}
echo json_encode($arr, JSON_UNESCAPED_UNICODE);
?>